<?php 
$user=$session->read('User');
$companyid=$session->read("companyid");
$userid=base64_encode($user["id"]);
$cid=base64_encode($companyid);
//$isflag=$action->checkPermissions($user,$companyid);
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $form->value('Company.company_name');?></h2>
	</div>
    <div class="right back_btn">
    <?php 
	    if($user['cid']){
	    	echo $html->link("编辑","/companys/editinfo/".$user['cid']);
	    }
	    else{
	    	$HTTP_REFERER=$_SERVER["HTTP_REFERER"];
	    	if($HTTP_REFERER){
	    		echo $html->link("返回","/companys/index/",array("onclick"=>"history.go(-1);return false;"));
	    	}
	    }
    ?>
    </div>
    <!--<div class="right back_btn">
			<?php 
//            	$urlpath=$accp->path."/loginsys?id=".$userid."&action=".base64_encode("company").'&cid='.$cid;
//            	echo '<a target="_blank" href="'.$urlpath.'">预览</a>';
            ?>
	</div>-->
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	<?php echo $form -> create('companys', array('url' => '/companys/editinfo/','enctype'=>'multipart/form-data','type'=> 'post','onsubmit'=>'return checksave()') ); ?>
         <div class="details_item_line">
             <div class="details_item">
                <div class="form_left_title left">企业Logo：</div>
                <div class="form_right_input left">
                <?php 
                $logoimg=$logo["file_path"];
               
                if($logoimg){
                ?>	
                <img alt="" src="../showthumbnail.php?path=<?php echo base64_encode($logoimg);?>" style="width:200px; height:80px;" />
                <?php 	
                } else 
	                	echo "暂无图片";
                ?>
                </div>
       		</div>
       	</div>
        <div class="details_item_line">
             <div class="details_item">
                <div class="form_left_title left"><?php __("Company Name")?>：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.company_name');?></div>
            </div>
        </div>
        <div class="details_item_line">
             <div class="details_item">
                <div class="form_left_title left">企业地址：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.license_address');?></div>
            </div>
        </div>        
        
        
        <div class="details_item_line">
            <div class="details_item">
            	 <div class="form_left_title left">所属产业：</div>
            	 <div class="form_right_add left">
                	<?php 
		            $industryidlist="";
		            if($pros_cvalues){
			            foreach($pros_cvalues as $pros_cvalue){
			            	if(!empty($pros_cvalue["cvid"])){
			            		$industryidlist.=$pros_cvalue["cvid"].',';
			            	}
			            }
		            }
		            ?>
		            <div id="pcvalueidlist" class="txthide"><?php echo $industryidlist?></div>
                	<div id="taglist" class="added_item_list left"></div>
                    <div class="add_item_btn left">
		                <div id="add_float_box" class="add_float_box" style="display:none;">
		                    <ul>
			                    <?php 
			                    $dan="'";
			                    foreach($industrys as $key=>$industry){
									echo "<li><label>";
									echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$industry.$dan.','.$dan."#ProjectIndustryname".$dan.','.$dan."#ProjectIndustryid".$dan.','.$dan."#taglist".$dan.')" value="'.$key.'" />'.$industry;
									echo "</label></li>";
									echo "<span id='span".$key."' class='txthide'>".$industry."</span>";
								}?> 
							</ul>
		                </div>
					</div>
                    <?php echo $form->text('Project.industryname',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
		            <?php echo $form->text('Project.industryid',array('class'=>'txthide'));?>
                </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
            	 <div class="form_left_title left">企业类型：</div>
            	 <div class="form_right_add left">
                	<?php 
		            $ctypeidlist="";
		            if($companytypes){
			            foreach($companytypes as $companytype){
			            	if(!empty($companytype["cvid"])){
			            		$ctypeidlist.=$companytype["cvid"].',';
			            	}
			            }
		            }
		            ?>
		            <div id="comptypeidlist" class="txthide"><?php echo $ctypeidlist?></div>
                	<div id="taglistct" class="added_item_list left"></div>
                    <div class="add_item_btn left">
		                <div id="add_float_boxct" class="add_float_box" style="display:none;">
		                    <ul>
			                    <?php 
			                    $dan="'";
			                    foreach($ctypes as $key=>$ctype){
									echo "<li><label>";
									echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$ctype.$dan.','.$dan."#ProjectCompanytypename".$dan.','.$dan."#ProjectCompanytypeid".$dan.','.$dan."#taglistct".$dan.')" value="'.$key.'" />'.$ctype;
									echo "</label></li>";
									echo "<span id='span".$key."' class='txthide'>".$ctype."</span>";
								}?> 
							</ul>
		                </div>
					</div>
                    <?php echo $form->text('Project.companytypename',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
		            <?php echo $form->text('Project.companytypeid',array('class'=>'txthide'));?>
                </div>
            </div>
        </div>
       	<!-- 信息来源 开始 -->
        <div class="details_item_line">
            <div class="details_item">
            	 <div class="form_left_title left">信息来源：</div>
            	 <div class="form_right_add left">
                	<?php 
		            $informationlist="";
		            if($informationfroms){
			            foreach($informationfroms as $informationfrom){
			            	if(!empty($informationfrom["cvid"])){
			            		$informationlist.=$informationfrom["cvid"].',';
			            	}
			            }
		            }
		            ?>
		            <div id="informationfromidlist" class="txthide"><?php echo $informationlist?></div>
		            <?php //debug($informationfroms);?>
                	<div id="taglistctim" class="added_item_list left"></div>
                    <div class="add_item_btn left">
		                <div id="add_float_boxct" class="add_float_box" style="display:none;">
		                    <ul>
			                    <?php 
			                    $dan="'";
			                    foreach($informations as $key=>$information){
									echo "<li><label>";
									echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$information.$dan.','.$dan."#ProjectInformationfromname".$dan.','.$dan."#ProjectInformationfromid".$dan.','.$dan."#taglistctim".$dan.')" value="'.$key.'" />'.$information;
									echo "</label></li>";
									echo "<span id='span".$key."' class='txthide'>".$information."</span>";
								}?> 
							</ul>
		                </div>
					</div>
                    <?php echo $form->text('Project.informationfromname',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
		            <?php echo $form->text('Project.informationfromid',array('class'=>'txthide'));?>
                </div>
            </div>
        </div>
        
        <!-- 信息来源 结束-->
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Regedit Time")?>：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.reg_time');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left"><?php __("Regedit Capital")?><span class="captype">(万)</span>：</div>
                <div class="form_right_input left">
	                <?php echo $form->value('Company.cap_type')=="0"?"￥":"＄"?>
	                <?php echo $form->value('Company.capital');?>
                </div>
            </div>
             <div class="details_item">
                <div class="form_left_title left">资金到位：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.is_funds')?"是":"否";?></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">入驻时间：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.resident_time');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">职工数量：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.workers');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">高企认定：</div>
                <div class="form_right_input left">
                  <?php echo $form->value('Company.is_height')?"是":"否";?>
                </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">企业负责人：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.contact');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left"><?php __("Tel")?>：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.tel')==0?'':$form->value('Company.tel');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left"><?php __("Mail")?>：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.email');?></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">常用联系人：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.usualcontact');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left"><?php __("Tel")?>：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.usualtel')==0?"":$form->value('Company.usualtel');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left"><?php __("Mail")?>：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.usualemail');?></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">法人身份证号：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.corporation_ID');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">法人护照号：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.passportNo');?></div>
            </div>
        </div>        
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">性别：</div>
                <div class="form_right_input left">
                <?php echo $form->value('Company.sex')?"女":"男"; ?>
                </div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">毕业院校：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.graduate_school');?></div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">学历学位：</div>
                <div class="form_right_input left">
                <?php
                	 $education=$form->value('Company.education');
                	 if($education){echo $educations[$education];}
                 ?>
                </div>
            </div>
        </div>
         <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">出生年月：</div>
                <div class="form_right_input left">
                <?php echo $form->value('Company.birthday'); ?>
                </div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">国籍：</div>
                <div class="form_right_input left"><?php echo $form->value('Company.nation');?></div>
            </div>
            
        </div>
<?php 
//	$support_funds;
	if (!empty($support_funds)){
		foreach ($support_funds as $key=>$support_fund){
			if(!empty($key)){
				$showCSFvalue = array();
				if (is_array($CompSupportFunds)){//至少有两条记录
					foreach ($CompSupportFunds as $CompSupportFund){
						if ($CompSupportFund['type_id'] == $key){
							$showCSFvalue = $CompSupportFund;
						}
					}
				}else{//只有一条记录
					if ($CompSupportFunds['type_id'] == $key){
						$showCSFvalue = $CompSupportFunds;
					}
				}
?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php echo $support_fund;?>：</div>
                <div class="form_right_input left"><?php echo empty($CompSupportFunds)?'':$showCSFvalue['capital'];?> 万元</div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">实收资本：</div>
                <div class="form_right_input left"><?php echo empty($CompSupportFunds)?'':$showCSFvalue['hascashed'];?> 万元</div>
            </div>
        </div>     
<?php 
			}
		}
	}
?>        
<!--         <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">科创园扶持金：</div>
                <div class="form_right_input left"><?php //echo $form->value('Company.custp_capital');?> 万元</div>
            </div>
            <div class="details_item">
                <div class="form_left_title left">实收资本：</div>
                <div class="form_right_input left"><?php //echo $form->value('Company.custp_cash');?> 万元</div>
            </div>
        </div>        -->
     
     <div class="details_item_line">  
            <div class="details_item">
                <div class="form_left_title left"><?php echo "电子材料" ;?>：</div>
                <div class="left">
                	<div class="file_category_list">
		        		<div id="filelist0" class="file_lists">
		        			<?php $dan="'";
			                	if($attachments){?>
		        			<ul class="picture_attach">
		        				<?php
			                	foreach($attachments as $attachment){
			                			$fname=$attachment["file_name"];
			                			$fpath=$attachment["file_path"];
			                			$fid=$attachment["id"];
			                			$createdtime=date("Y-m-d",strtotime($attachment["created"]));
			                			$isimg=$str->checkimg($fname);
			                			if($isimg){
											echo "<li>";
											echo '<div class="picture_info">';
											echo "<span>".$fname."</span>";
											echo "<span class='source_upload_date'>".$createdtime.$html->link("下载",'/projects/download/'.$attachment["id"],null)."</span>";
											echo "</div>";
											//if($isflag){
												echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
											//}
											$img=$html->image("/".$fpath);
											echo "<span>".$html->link($img,'javascript:void(0);',array('onclick'=>"openimg(".$dan."f".$fid.$dan.")",'escape' => false))."</span>";
											echo "<div style='display:none' id='f".$fid."' title='".$fname."'>".$img."</div>";
											
											echo "</li>";
										}
									}
			                	?>
		        				<div class="clear"></div>
		        			</ul>
		        			<ul class="file_attach">
			                	<?php
			                	foreach($attachments as $attachment){
			                			$fname=$attachment["file_name"];
			                			$isimg=$str->checkimg($fname);
			                			if(!$isimg){
											echo "<li>";
											echo "<span>".$html->link($fname,'/projects/download/'.$attachment["id"],null)."</span>";
											echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
											//if($isflag){
												echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
											//}
											echo "</li>";
										}
									}
			                	?>
			                	<div class="clear"></div>
			                </ul>
			                <?php 
			                	}else{
									echo '<div class="form_right_input left">暂无文件</div>';
								}
			                ?>
		                </div>
		             </div>
				</div>
            </div>
        </div>
        </form>
    </div>
</div>
<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
<?php echo $javascript->link('project.js');?>